/******************************************************************************
 * Copyright 2023 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#pragma once

#include "modules/canbus_vehicle/x3epro/proto/x3epro.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"

namespace apollo {
namespace canbus {
namespace x3epro {

class Vcupowerstatus214 : public ::apollo::drivers::canbus::ProtocolData<
                    ::apollo::canbus::X3epro> {
 public:
  static const int32_t ID;
  Vcupowerstatus214();
  void Parse(const std::uint8_t* bytes, int32_t length,
                     X3epro* chassis) const override;

 private:

    // config detail: {'bit': 11, 'enum': {0: 'VCU_POWERMODE_OFF', 1: 'VCU_POWERMODE_IG_ON', 2: 'VCU_POWERMODE_POWER_ON', 3: 'VCU_POWERMODE_AUTO_ON', 4-7: 'VCU_POWERMODE_RESERVED'}, 'is_signed_var': False, 'len': 3, 'name': 'VCU_PowerMode', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
    Vcu_powerstatus_214::Vcu_powermodeType vcu_powermode(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 13, 'enum': {0: 'VCU_POWERMODEVALID_NOT_AVAILABLE', 1: 'VCU_POWERMODEVALID_INVALID', 2: 'VCU_POWERMODEVALID_VALID', 3: 'VCU_POWERMODEVALID_RESERVED'}, 'is_signed_var': False, 'len': 2, 'name': 'VCU_PowerModeValid', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
    Vcu_powerstatus_214::Vcu_powermodevalidType vcu_powermodevalid(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 14, 'enum': {0: 'REPLACEBATTERYSTATEINDICATION_NOTACTIVATE', 1: 'REPLACEBATTERYSTATEINDICATION_ACTIVATE'}, 'is_signed_var': False, 'len': 1, 'name': 'ReplaceBatteryStateIndication', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
    Vcu_powerstatus_214::ReplacebatterystateindicationType replacebatterystateindication(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 23, 'is_signed_var': False, 'len': 16, 'name': 'BCU_ChargeDischargeCurrent', 'offset': -400.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'A', 'precision': 0.02, 'type': 'double'}
    double bcu_chargedischargecurrent(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 39, 'is_signed_var': False, 'len': 16, 'name': 'BCU_BATT_InternalVoltage', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'V', 'precision': 0.01, 'type': 'double'}
    double bcu_batt_internalvoltage(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 55, 'is_signed_var': False, 'len': 4, 'name': 'VCU_DriverInfo_AliveCounter', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'int'}
    int vcu_driverinfo_alivecounter(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name': 'VCU_DriverInfo_CheckSum', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'int'}
    int vcu_driverinfo_checksum(const std::uint8_t* bytes, const int32_t length) const;
};

}  // namespace x3epro
}  // namespace canbus
}  // namespace apollo


